package com.jkt.rms.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;

import com.jkt.rms.businessservice.TemplateBusinessService;
import com.jkt.rms.commons.utils.RMSException;
import com.jkt.rms.commons.utils.ServiceLocator;

public class TemplateController extends SimpleFormController {
	
	private static final Logger LOG = Logger.getLogger(TemplateController.class);
	private TemplateBusinessService templateBusinessService;
	
	@Override
	public ModelAndView handleRequest(HttpServletRequest arg0,
			HttpServletResponse arg1) throws RMSException {
		LOG.info("====handleRequest===TemplateController");
		return new ModelAndView("template");
	}
	
	public String getWelcomeString(String s)	{
		if(templateBusinessService == null)
			setBusinessService((TemplateBusinessService)ServiceLocator.getServiceLocator().locate("templateBusinessService"));
		
		return (templateBusinessService.getWelcomeString(s));
	}
	public void setBusinessService(TemplateBusinessService service){
			this.templateBusinessService = service;
	}
}